package com.hnichr.crm.common.product.entity;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author: Cheng
 * @date: 2022/12/26
 */
@Service
public interface CrmProductDao extends JpaRepository<CrmProduct, String> {

    @Query(value = "select " +
            "date_format(create_time, '%Y-%m-%d') create_time, " +
            "count(id) num " +
            "from " +
            "crm_product " +
            " where create_time between ? and ?"+
            "group by " +
            "date_format(create_time, '%Y-%m-%d') " +
            "order by create_time", nativeQuery = true)
    public List<Map<String,Object>> getIncrease(Date begin, Date end);
}
